<template>
  <div class="address" v-if="defaultAddressList[0]" @click="jumpTo">
    <van-icon name="location-o" />
    <span>{{
      defaultAddressList[0].province + defaultAddressList[0].city
    }}</span>
  </div>
</template>

<script>
import Vue from "vue";
import { Icon } from "vant";
import { getdefaultAddress } from "../../apis/address";
Vue.use(Icon);
export default {
  name: "Address",

  data() {
    return {
      defaultAddressList: [],
    };
  },

  mounted() {},

  methods: {
    jumpTo(){
    this.$router.push("/address")
  }
  },
  created() {
    getdefaultAddress({ userid: localStorage.getItem("userid") }).then(
      (data) => {
        this.defaultAddressList = data.data.data;
      }
    );
  },
  
};
</script>

<style scoped>
.address {
  background-color: #fff;
  margin-bottom: 0.2rem;

  padding: .1rem;
}
.address span {
  display: inline-block;
  margin-left: 0.05rem;
  line-height: .3rem;
}
</style>